﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MediaImporter.Controls
{
    public partial class TextSetting : UserControl, MediaImporter.Controls.ITextSettingControl
    {

        public event EventHandler ActionPressed;

        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        [EditorBrowsable(EditorBrowsableState.Always)]
        public override string Text
        {
            get
            {
                return label1.Text;
            }
            set
            {
                label1.Text = value;
            }
        }

        public int LabelWidth
        {
            get { return label1.Size.Width; }
            set
            {
                label1.AutoSize = false;
                label1.SetBounds(0, 0, value, 0, BoundsSpecified.Width);
            }
        }

        public string ButtonText
        {
            get
            {
                return buttonAction.Text;
            }
            set
            {
                buttonAction.Text = value;
            }
        }
        public string Value
        {
            get
            {
                return textBox1.Text;
            }
            set
            {
                textBox1.Text = value;
            }
        }


        public TextSetting()
        {
            InitializeComponent();
        }

        private void buttonAction_Click(object sender, EventArgs e)
        {
            if (ActionPressed != null)
                ActionPressed(this, EventArgs.Empty);
        }
    }
}
